#include "stdafx.h"
#include "CToolbarEx.h"
#include "resource.h"

#pragma comment(lib, "comctl32.lib")

HWND CToolbarEx::CreateMainFrame(HWND hWnd,HINSTANCE hInst, int ID_BITMAP)
{
	const int NUMBERBUTTONS = 32;//So luong button tren thanh Toolbar
	TBBUTTON tbrButtons[NUMBERBUTTONS];

	//FILE TOOL
	tbrButtons[0].iBitmap   = 0;
	tbrButtons[0].idCommand = ID_FILE_CREATE;
	tbrButtons[0].fsState   = TBSTATE_ENABLED ;
	tbrButtons[0].fsStyle   = TBSTYLE_BUTTON;
	tbrButtons[0].dwData    = 0L;
	tbrButtons[0].iString	= 0;

	tbrButtons[1].iBitmap   = 1;
	tbrButtons[1].idCommand = ID_FILE_OPEN;
	tbrButtons[1].fsState   = TBSTATE_ENABLED;
	tbrButtons[1].fsStyle   = TBSTYLE_BUTTON;
	tbrButtons[1].dwData    = 0L;
	tbrButtons[1].iString	= 0;

	tbrButtons[2].iBitmap   = 2;
	tbrButtons[2].idCommand = ID_FILE_SAVE;
	tbrButtons[2].fsState   = TBSTATE_ENABLED;
	tbrButtons[2].fsStyle   = TBSTYLE_BUTTON;
	tbrButtons[2].dwData    = 0L;
	tbrButtons[2].iString	= 0;

	tbrButtons[3].iBitmap   = 25;
	tbrButtons[3].idCommand = IDC_BUTTON_DELETE;
	tbrButtons[3].fsState   = TBSTATE_ENABLED;
	tbrButtons[3].fsStyle   = TBSTYLE_BUTTON;
	tbrButtons[3].dwData    = 0L;
	tbrButtons[3].iString	= 0;

	// VACH NGAN
	tbrButtons[4].iBitmap   = 25;
	tbrButtons[4].idCommand = 0;
	tbrButtons[4].fsState   = TBSTATE_ENABLED;
	tbrButtons[4].fsStyle   = TBSTYLE_SEP;
	tbrButtons[4].dwData    = 0L;
	tbrButtons[4].iString   = 0;
	
	//  SHAPE TOOL
	tbrButtons[5].iBitmap   = 18;
	tbrButtons[5].idCommand = IDC_BUTTON_SELECTLINE;
	tbrButtons[5].fsState   = TBSTATE_ENABLED ;
	tbrButtons[5].fsStyle   = TBSTYLE_BUTTON;
	tbrButtons[5].dwData    = 0L;
	tbrButtons[5].iString   = 0;
	
	tbrButtons[6].iBitmap   = 7;
	tbrButtons[6].idCommand = IDC_BUTTON_SELECT;
	tbrButtons[6].fsState   = TBSTATE_ENABLED;
	tbrButtons[6].fsStyle   = TBSTYLE_CHECK;
	tbrButtons[6].dwData    = 0L;
	tbrButtons[6].iString	= 0;

	tbrButtons[7].iBitmap   = 9;
	tbrButtons[7].idCommand = IDC_BUTTON_LINE;
	tbrButtons[7].fsState   = TBSTATE_ENABLED;
	tbrButtons[7].fsStyle   = TBSTYLE_CHECK;
	tbrButtons[7].dwData    = 0L;
	tbrButtons[7].iString	= 0;

	tbrButtons[8].iBitmap   = 8;
	tbrButtons[8].idCommand = IDC_BUTTON_CIRCLE;
	tbrButtons[8].fsState   = TBSTATE_ENABLED;
	tbrButtons[8].fsStyle   = TBSTYLE_CHECK;
	tbrButtons[8].dwData    = 0L;
	tbrButtons[8].iString	= 0;

	tbrButtons[9].iBitmap   = 10;
	tbrButtons[9].idCommand = IDC_BUTTON_RECTANGLE;
	tbrButtons[9].fsState   = TBSTATE_ENABLED;
	tbrButtons[9].fsStyle   = TBSTYLE_CHECK;
	tbrButtons[9].dwData    = 0L;
	tbrButtons[9].iString	= 0;

	tbrButtons[10].iBitmap   = 12;
	tbrButtons[10].idCommand = IDC_BUTTON_TRIANGLE;
	tbrButtons[10].fsState   = TBSTATE_ENABLED;
	tbrButtons[10].fsStyle   = TBSTYLE_CHECK;
	tbrButtons[10].dwData    = 0L;
	tbrButtons[10].iString   = 0;

	tbrButtons[11].iBitmap   = 13;
	tbrButtons[11].idCommand = IDC_BUTTON_ROUNDRECTANGLE;
	tbrButtons[11].fsState   = TBSTATE_ENABLED;
	tbrButtons[11].fsStyle   = TBSTYLE_CHECK;
	tbrButtons[11].dwData    = 0L;
	tbrButtons[11].iString   = 0;

	tbrButtons[12].iBitmap   = 43;
	tbrButtons[12].idCommand = IDC_BUTTON_TEXT;
	tbrButtons[12].fsState   = TBSTATE_ENABLED;
	tbrButtons[12].fsStyle   = TBSTYLE_CHECK;
	tbrButtons[12].dwData    = 0L;
	tbrButtons[12].iString   = 0;

	//Vach ngan
	tbrButtons[13].iBitmap   = 25;
	tbrButtons[13].idCommand = ID_SEP2;
	tbrButtons[13].fsState   = TBSTATE_ENABLED;
	tbrButtons[13].fsStyle   = TBSTYLE_SEP;
	tbrButtons[13].dwData    = 0L;
	tbrButtons[13].iString   = 0;

	//---nhom  Mau sac cua line--------------
	tbrButtons[14].iBitmap   = 34;
	tbrButtons[14].idCommand = IDC_BUTTON_NAVY;
	tbrButtons[14].fsState   = TBSTATE_ENABLED;
	tbrButtons[14].fsStyle   = TBSTYLE_CHECK;
	tbrButtons[14].dwData    = 0L;
	tbrButtons[14].iString   = 0;

	tbrButtons[15].iBitmap   = 32;
	tbrButtons[15].idCommand = IDC_BUTTON_VIOLET;
	tbrButtons[15].fsState   = TBSTATE_ENABLED;
	tbrButtons[15].fsStyle   = TBSTYLE_CHECK;
	tbrButtons[15].dwData    = 0L;
	tbrButtons[15].iString   = 0;

	tbrButtons[16].iBitmap   = 36;
	tbrButtons[16].idCommand = IDC_BUTTON_BLACK;
	tbrButtons[16].fsState   = TBSTATE_ENABLED;
	tbrButtons[16].fsStyle   = TBSTYLE_CHECK;
	tbrButtons[16].dwData    = 0L;
	tbrButtons[16].iString   = 0;

	tbrButtons[17].iBitmap   = 37;
	tbrButtons[17].idCommand = IDC_BUTTON_RED;
	tbrButtons[17].fsState   = TBSTATE_ENABLED;
	tbrButtons[17].fsStyle   = TBSTYLE_CHECK;
	tbrButtons[17].dwData    = 0L;
	tbrButtons[17].iString   = 0;

	tbrButtons[18].iBitmap   = 38;
	tbrButtons[18].idCommand = IDC_BUTTON_GREEN;
	tbrButtons[18].fsState   = TBSTATE_ENABLED;
	tbrButtons[18].fsStyle   = TBSTYLE_CHECK;
	tbrButtons[18].dwData    = 0L;
	tbrButtons[18].iString   = 0;

	tbrButtons[19].iBitmap   = 39;
	tbrButtons[19].idCommand = IDC_BUTTON_BROWN;
	tbrButtons[19].fsState   = TBSTATE_ENABLED;
	tbrButtons[19].fsStyle   = TBSTYLE_CHECK;
	tbrButtons[19].dwData    = 0L;
	tbrButtons[19].iString   = 0;

	tbrButtons[20].iBitmap   = 40;
	tbrButtons[20].idCommand = IDC_BUTTON_YELLOW;
	tbrButtons[20].fsState   = TBSTATE_ENABLED;
	tbrButtons[20].fsStyle   = TBSTYLE_CHECK;
	tbrButtons[20].dwData    = 0L;
	tbrButtons[20].iString   = 0;

	tbrButtons[21].iBitmap   = 41;
	tbrButtons[21].idCommand = IDC_BUTTON_BLUE;
	tbrButtons[21].fsState   = TBSTATE_ENABLED;
	tbrButtons[21].fsStyle   = TBSTYLE_CHECK;
	tbrButtons[21].dwData    = 0L;
	tbrButtons[21].iString   = 0;


	//Vach ngan
	tbrButtons[22].iBitmap   = 25;
	tbrButtons[22].idCommand = ID_SEP3;
	tbrButtons[22].fsState   = TBSTATE_ENABLED;
	tbrButtons[22].fsStyle   = TBSTYLE_SEP;
	tbrButtons[22].dwData    = 0L;
	tbrButtons[22].iString   = 0;

	////---Nhom  Mau nen------------------------ !!!!!!!!!moi them ID them vao chu F o dau!!!!!!!------------------------------
	tbrButtons[23].iBitmap   = 34;
	tbrButtons[23].idCommand = IDC_BUTTON_FNAVY;
	tbrButtons[23].fsState   = TBSTATE_ENABLED;
	tbrButtons[23].fsStyle   = TBSTYLE_CHECK;
	tbrButtons[23].dwData    = 0L;
	tbrButtons[23].iString   = 0;

	tbrButtons[24].iBitmap   = 32;
	tbrButtons[24].idCommand = IDC_BUTTON_FVIOLET;
	tbrButtons[24].fsState   = TBSTATE_ENABLED;
	tbrButtons[24].fsStyle   = TBSTYLE_CHECK;
	tbrButtons[24].dwData    = 0L;
	tbrButtons[24].iString   = 0;

	tbrButtons[25].iBitmap   = 36;
	tbrButtons[25].idCommand = IDC_BUTTON_FBLACK;
	tbrButtons[25].fsState   = TBSTATE_ENABLED;
	tbrButtons[25].fsStyle   = TBSTYLE_CHECK;
	tbrButtons[25].dwData    = 0L;
	tbrButtons[25].iString   = 0;

	tbrButtons[26].iBitmap   = 37;
	tbrButtons[26].idCommand = IDC_BUTTON_FRED;
	tbrButtons[26].fsState   = TBSTATE_ENABLED;
	tbrButtons[26].fsStyle   = TBSTYLE_CHECK;
	tbrButtons[26].dwData    = 0L;
	tbrButtons[26].iString   = 0;

	tbrButtons[27].iBitmap   = 38;
	tbrButtons[27].idCommand = IDC_BUTTON_FGREEN;
	tbrButtons[27].fsState   = TBSTATE_ENABLED;
	tbrButtons[27].fsStyle   = TBSTYLE_CHECK;
	tbrButtons[27].dwData    = 0L;
	tbrButtons[27].iString   = 0;

	tbrButtons[28].iBitmap   = 39;
	tbrButtons[28].idCommand = IDC_BUTTON_FBROWN;
	tbrButtons[28].fsState   = TBSTATE_ENABLED;
	tbrButtons[28].fsStyle   = TBSTYLE_CHECK;
	tbrButtons[28].dwData    = 0L;
	tbrButtons[28].iString   = 0;

	tbrButtons[29].iBitmap   = 40;
	tbrButtons[29].idCommand = IDC_BUTTON_FYELLOW;
	tbrButtons[29].fsState   = TBSTATE_ENABLED;
	tbrButtons[29].fsStyle   = TBSTYLE_CHECK;
	tbrButtons[29].dwData    = 0L;
	tbrButtons[29].iString   = 0;

	tbrButtons[30].iBitmap   = 41;
	tbrButtons[30].idCommand = IDC_BUTTON_FBLUE;
	tbrButtons[30].fsState   = TBSTATE_ENABLED;
	tbrButtons[30].fsStyle   = TBSTYLE_CHECK;
	tbrButtons[30].dwData    = 0L;
	tbrButtons[30].iString   = 0;
	
	tbrButtons[31].iBitmap   = 31;
	tbrButtons[31].idCommand = IDC_BUTTON_NOBG;
	tbrButtons[31].fsState   = TBSTATE_ENABLED;
	tbrButtons[31].fsStyle   = TBSTYLE_CHECK;
	tbrButtons[31].dwData    = 0L;
	tbrButtons[31].iString   = 0;

	
	

	HWND hWndToolbar;


	hWndToolbar = CreateToolbarEx(hWnd,
		WS_VISIBLE | WS_CHILD | WS_BORDER | TBSTYLE_FLAT
		| WS_CLIPCHILDREN 
		| WS_CLIPSIBLINGS 
		| TBSTYLE_TOOLTIPS,
		ID_BITMAP,
		NUMBERBUTTONS,
		(HINSTANCE)hInst,
		ID_BITMAP,
		(LPCTBBUTTON)&tbrButtons,
		NUMBERBUTTONS,
		16, 16, 16, 16,
		sizeof(TBBUTTON));

	if(hWndToolbar) 
		return hWndToolbar;
	else
		return NULL;
}

void CToolbarEx::CreateToolBar()
{}